﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ja">
<head>
<title>S_IsTextSelectedの使用例</title>
<LINK REL="stylesheet" TYPE="text/css" HREF="../sakura.css">
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
</head>
<body>
<small>
Sakura-Editor Macro Reference
</small>
<h2>S_IsTextSelectedの使用例</h2>

<pre>
<span style="color:green;">//sample.js
//選択状態を取得</span>
<span style="color:blue;">var</span> sBuf;
<span style="color:blue;">switch</span> ( <span style="color:blue;">IsTextSelected</span> ){
<span style="color:blue;">case</span> <span style="color:red;">0</span>:
    sBuf = <span style="color:#800000;">"選択されたテキストはありません。"</span>;
    <span style="color:blue;">break</span>;
<span style="color:blue;">case</span> <span style="color:red;">1</span>:
    sBuf = <span style="color:#800000;">"選択中の文字列は\n\n"</span>;
    <span style="color:blue;">break</span>;
<span style="color:blue;">case</span> <span style="color:red;">2</span>:
    sBuf = <span style="color:#800000;">"矩形選択されています\n\n"</span>;
    <span style="color:blue;">break</span>;
}

sBuf += <span style="color:blue;">GetSelectedString</span>(<span style="color:red;">0</span>);   

<span style="color:blue;">var</span> oWsh = <span style="color:blue;">new</span> ActiveXObject(<span style="color:#800000;">"WScript.Shell"</span>);
oWsh.Popup(sBuf, <span style="color:red;">0</span>, <span style="color:#800000;">""</span>, <span style="color:red;">0</span>);
</pre>

<pre>
<span style="color:green;">//sample.ppa</span>
<span style="color:blue;">case S_IsTextSelected of</span>
<span style="color:red;">0</span>:
    <span style="color:blue;">MessageBox</span>(<span style="color:#800000;">'非選択状態です'</span>, <span style="color:#800000;">''</span>, <span style="color:red;">0</span>);
<span style="color:red;">1</span>:
    <span style="color:blue;">MessageBox</span>(<span style="color:blue;">S_GetSelectedString</span>(<span style="color:red;">0</span>), <span style="color:#800000;">'選択文字列'</span>, <span style="color:red;">0</span>);
<span style="color:red;">2</span>:
    <span style="color:blue;">MessageBox</span>(<span style="color:blue;">S_GetSelectedString</span>(<span style="color:red;">0</span>), <span style="color:#800000;">'矩形選択文字列'</span>, <span style="color:red;">0</span>);
<span style="color:blue;">end</span>;
</pre>

<hr>
</body></html>
